package db

import (
	"database/sql"
	"gitee.com/gorm"
	_ "gitee.com/gorm/dialects/mysql"
	_ "github.com/go-sql-driver/mysql"
)

var (
	Db     *sql.DB
	GormDb *gorm.DB
	err    error
)

func init() {
	Db, err = sql.Open("mysql", "jyzk:jyzk36801580@tcp(localhost:3306)/dcs")
	if err != nil {
		panic(err.Error())
	}

	//var err error
	GormDb, err = gorm.Open("mysql", "jyzk:jyzk36801580@tcp(127.0.0.1:3306)/dcs?charset=utf8&parseTime=True&loc=Local")
	if err != nil {
		panic(err)
	}

	GormDb.LogMode(true)
	GormDb.SingularTable(true)
}
